package com.chancein.cloud.ocr.process.util;

import cn.hutool.core.util.StrUtil;
import lombok.extern.slf4j.Slf4j;

/**
 * 解析对象host类
 *
 * @author: LiaoZiHao
 * @date: 2023/8/8 18:13
 * Copyright © 2022 Hundsun Technologies Inc. All Rights Reserved
 */
@Slf4j
public class ParseHostUtils {

    public static final String webHost = "http://10.5.23.199:8088";

    /**
     * 判断url是否需要进行host拼接
     *
     * @date 2023/8/8 18:16
     * @author liaozihao
     * @param url 链接地址
     * @return {@link String} 完整链接地址
     */
    public static String getFullUrl(String url) {
        if (StrUtil.isNotBlank(url) && !url.startsWith("http")) {
            if (url.startsWith("/")) {
                url = webHost + url;
            } else {
                url = webHost + "/" + url;
            }
        }
        return url;
    }

}
